<!DOCTYPE html>
<html>
<head>
	<title><?php echo $title." | ".$desc ?></title>
	<?php $this->load->view('assets-importer'); ?>	
	<link rel="stylesheet" type="text/css" href="<?php echo base_url('asset/css/user-style.css') ?>"/>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url('asset/css/user-media-queries.css') ?>"/>

</head>
<body>
	<?php $this->load->view('nav'); ?>
	<div id="outer">
		<div class="container">
			<div id="user-panel-content">
				<div class="jgnuwsnavbox">
					<div id="usr-menu-container" class="col-md-4 col-sm-4 junorl">
						<div class="settbox">
							<div class="settproimg">
								<div class="setimgsize">
									<?php if(get_cookie('c_usr_photo') != ""): ?>
										<img src="<?php echo base_url("asset/img/auth-foto/".get_cookie('c_usr_photo')); ?>" width="100%" alt="foto profil">
									<?php else: ?>
										<img src="<?php echo base_url('asset/img/auth-foto/default-foto.png'); ?>" width="100%" alt="foto profil">
									<?php endif; ?>
									<a data-toggle="modal" href="#modal-chg-foto" class="setimgbtn"><span>Change</span></a>
									<div class="modal fade" id="modal-chg-foto" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
										<div class="modal-dialog">
											<div class="modal-content">
												<div class="modal-body">
													<form action="<?php echo site_url('user/update_pp'); ?>" method="post" enctype="multipart/form-data">
														<input type="file" class="grab-file" name="foto" />
														<small class="lbl-sm lbl-sm-danger">Square Photo. Max width: 1000px</small><br/><br/>
														<input type="submit" class="btn-jonu-full" value="Upload" name="btn_usr_photo_upload" />
													</form>
												</div>
											</div><!-- /.modal-content -->
										</div><!-- /.modal-dialog -->
									</div>
								</div>
							</div>
							<div class="settprousr">
								<p class="settprousrusr"><?php echo get_cookie('c_usr_fullname') ?></p>
								<div class="setprousrdes"><?php echo get_cookie('c_usr_usrname') ?></div>
								
								<?php  
								#get jumlah post
								$this->db->where('jonu_user_id', get_cookie('c_usr_id'));
								$jml_post = $this->db->count_all_results('jonu_post');
								?>
								<span class="badge"><?php echo $jml_post." Post" ?></span>
							</div>
							<a data-toggle="modal" href="#modal-chg-pass" class="chgpass kanan">Ganti Password</a>
							
							<div class="modal fade" id="modal-chg-pass" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content">
										<div class="modal-body">
											<form action="<?php echo site_url('user/change_pass') ?>" method="post">
												<label>Old Password</label>
												<input type="password" name="old_pass" class="form-control input-sm" required="required"/>
												<label>New Password</label>
												<input type="password" name="new_pass" class="form-control input-sm" required="required"/>
												<label>Re-type New Password</label>
												<input type="password" name="retype_new_pass" class="form-control input-sm" required="required"/>
												<input class="btn-jonu-full" type="submit" name="btn_chg_pass" value="Change Password"/>
											</form>
										</div>
									</div><!-- /.modal-content -->
								</div><!-- /.modal-dialog -->
							</div>
							<div class="sambungfloat"></div>
						</div>
						
						<?php  
						$uri = $this->uri->segment(2);
						$setting_arr = array('pengaturan');
						$post_arr = array('post', 'edit_post');
						?>
						<ul id="usr-menu">
							<li>
								<?php if(in_array($uri, $post_arr)): ?><a href="<?php echo site_url('user/post') ?>" class="active">
								<?php else: ?><a href="<?php echo site_url('user/post') ?>"><?php endif; ?>
									<i class="fa fa-fw fa-files-o"></i> Posts
								</a>
							</li>
							<li>
								<?php if(in_array($uri, $setting_arr)): ?><a href="<?php echo site_url('user/pengaturan') ?>" class="active">
								<?php else: ?><a href="<?php echo site_url('user/pengaturan') ?>"><?php endif; ?>
									<i class="fa fa-fw fa-cog"></i> Setting
								</a>
							</li>
							<li><a href="#"><i class="fa fa-fw fa-power-off"></i> Logout</a></li>
						</ul>
					</div>	
					<div class="col-md-8 col-sm-8 junorl">			
						<?php 
						$notif = $this->session->flashdata('notif');
						$status = $this->session->flashdata('notif_status');
						?>

						<?php if($status != ""): ?>
							<?php if($status == "0"): ?>
								<div class="notif notif-gagal"><?php echo $notif ?></div>
							<?php endif; ?>
							<?php if($status == "1"): ?>
								<div class="notif notif-sukses"><?php echo $notif ?></div>
							<?php endif; ?>
						<?php endif; ?>
						<?php $this->load->view("user/pages/$page") ?>
					</div>
					<div class="sambungfloat"></div>
				</div>
			</div>
		</div>	

		<div class="container credit">
			Copyright &copy; 2015. <a href="<?php echo site_url() ?>">Jogja Nuws</a>.
		</div>	
	</div>
</div>
</body>
</html>